package org.tong.minio;

import com.amazonaws.client.builder.AwsClientBuilder;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author
 * @date 2022-09-02 13:30
 */
@Configuration
public class MinioCfg {

    private String endPoint = "localhost:9000";

    private String region = "";

    @Bean
    public AmazonS3 initClient() {
        AwsClientBuilder.EndpointConfiguration endpointConfig =
                new AwsClientBuilder.EndpointConfiguration(endPoint, region);
        AmazonS3 amazonS3 = AmazonS3Client.builder()
                .withEndpointConfiguration(endpointConfig)
                .build();
        return amazonS3;
    }

    @Test
    public void test(){

    }
}
